package top.wyloop.fasthome.module.system.model.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Index;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;
import top.wyloop.fasthome.util.PrimaryKeyGenerator;

import java.util.Date;

/**
 * @author Wyatt6
 * @date 2025/5/9
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "tb_system_home", indexes = {
        @Index(columnList = "adminId"),
        @Index(columnList = "name")
})
public class Home {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "PK_generator")
    @GenericGenerator(name = "PK_generator", type = PrimaryKeyGenerator.class)
    private Long id;            // 主键
    @Column(nullable = false)
    private Long adminId;       // 管理员（创建人）ID
    @Column(nullable = false)
    private String name;        // 家庭名称
    @Column(nullable = false)
    private String password;    // 管理口令
    @Column(nullable = false)
    private String salt;        // 加密盐
    @Column
    private Date createTime;    // 创建时间
}
